<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="author" content="金西振">
    <title></title>
    <style>
    .box{
      width: 200px;
      height: 200px;
      background-color: red;
    }
    .blue{
      background-color: blue;
    }
    </style>
  </head>
  <body>
    <div class="box" id="box"></div>
    <script>
      var box = document.getElementById("box");

      // 布尔值
      // 对2求余法
      // 添加和移除类名
      // 判断背景颜色的值等
      box.onclick = function() {
        console.log('点击了div标签');

        box.style.backgroundColor = 'blue';
      }
    
    </script>
  </body>
</html>